import createGenerateClassName from "@material-ui/core/styles/createGenerateClassName";
import jssPreset from "@material-ui/core/styles/jssPreset";
import createHashHistory from "history/createHashHistory";
import {create} from "jss";
import * as React from "react";
// @ts-ignore
import JssProvider from "react-jss/lib/JssProvider";
import {renderRoutes} from 'react-router-config';
import {Router} from "react-router-dom";
import routes from "./views/routers";
import withRoot from "./withRoot";

const generateClassName = createGenerateClassName();
const jss = create(jssPreset());

const hashHistory = createHashHistory();

class App extends React.Component {
    public render() {
        return (
            <div style={{"fontSize": "16px"}}>
                <JssProvider jss={jss} generateClassName={generateClassName}>
                    <Router history={hashHistory}>
                        <div>
                            {renderRoutes(routes)}
                        </div>
                    </Router>
                </JssProvider>
            </div>
        );
    }
}

export default withRoot(App);
